package com.gcxy.controller;

import com.gcxy.domain.dto.loginDto;
import com.gcxy.config.result.R;
import com.gcxy.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
@Api(tags = "登录管理")
public class loginController {
    @Autowired
    private IUserService userService;

    @ApiOperation(value = "登录接口", notes = "登录接口")
    @PostMapping("/login")
    public R login(@Validated @RequestBody loginDto loginDto) {
        return userService.login(loginDto);
    }

    @ApiOperation(value = "退出登录接口", notes = "退出登录接口")
    @PostMapping("/logout")
    public R logout() {
        System.out.println("logout ");
        return userService.logout();
    }



}
